package net.qhzw.admin.controller;

import net.qhzw.admin.constant.ServerConfig;
import net.qhzw.common.model.JsonResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.net.InetAddress;

@RestController
public class IndexController {

    public String getIp() {
        InetAddress address = null;
        try {
            address = InetAddress.getLocalHost();
            return address.getHostAddress();
        } catch (Exception e) {
            return null;
        }

    }


    @GetMapping("hello")
    public JsonResult hello() {
        return JsonResult.success("hello" + getIp());
    }

    @RequestMapping("/login")
    public String login() {
        String fileUrl = ServerConfig.getFileUrl();
        return "login " + fileUrl;
    }
}
